package com.content.view.Share.Player
{
	import com.content.model.GlobalVarProxy;
	import com.content.model.LoadedAssets.ConfigProxy;
	import com.content.model.OnlineRes.OnlineResVO_Book;
	import com.content.view.AppMediator;
	import com.library.core.IDisposable;
	
	import flash.display.Sprite;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class BookPlayer_Mediator extends Mediator implements IMediator, IDisposable
	{
		public static const NAME:String							= 'BookPlayer_Mediator';
		
		private var _view:BookPlayer;
	
		public function BookPlayer_Mediator(viewComponent:Object=null)
		{
			super( NAME, viewComponent );
		}
		
		override public function onRegister():void
		{
			_view = new BookPlayer();//PdfPlayer.instance;
			ParentView.addChild( _view );
			_view.Init(ParentView.stage);
		}
		
		override public function listNotificationInterests():Array
		{
			return [
				App.RESIZE_SYS
			];
		}
		
		/* Event Handler
		 * ---------------------------------------------------- */
		override public function handleNotification(notification:INotification):void
		{
			var name:String = notification.getName();
			var body:Object = notification.getBody();
			
			switch ( name )
			{
				case App.RESIZE_SYS:
					var sWidth:int = body["width"];
					var sHeight:int = body["height"];
					_view.SetLayout(sWidth, sHeight);
					break;
			}
		}
		
		public function Play(vo:OnlineResVO_Book):void{	_view.Play(vo);	}
		public function Dispose():void{}
		
		private function get ParentView():Sprite	{	return viewComponent as Sprite;		}
		private function get P_Config():ConfigProxy {return facade.retrieveProxy( ConfigProxy.NAME ) as ConfigProxy;}		
		private function get P_GlobalVar():GlobalVarProxy	{return facade.retrieveProxy( GlobalVarProxy.NAME ) as GlobalVarProxy;}		
	}
}